package gspushmq.v1.thread;
import java.util.concurrent.ThreadPoolExecutor;

import gspushmq.v1.subscribe.core.HandlerSubscribe;
import gspushmq.v1.subscribe.handler.core.GGHandler;
import gspushmq.v1.subscribe.send.core.GGSend;


public enum GGThreadPool {

	threadPool;
	
	private ThreadPoolExecutor getChannel() {
		return  GGThreadPoolExecutor.pools.getConnection();
	}
	
	/**
	 * 提交 任务给线程池
	 * @param task
	 */
	public void commitTask(Runnable task){
		getChannel().execute(task);
	}
	
	public void commit(HandlerSubscribe handleMess){
		commitTask(handleMess);
	}

	public void start(GGSend send) {
		getChannel().execute(send);
	}
	
	public void execute(GGHandler command) {
		getChannel().execute(command);
	}


}
